#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

void GenFactors(int n, vector< pair<int, int> > &pri){
    for(int i = 2; n / i >= i; i++){
        int cnt = 0;
        
        for(; n % i == 0; n /= i, cnt++);
        if(cnt){
            pri.push_back(make_pair(i, cnt));
        }
    }
    if(n != 1){
        pri.push_back(make_pair(n, 1));
    }
}

void GenDiv(int dep, int num, const vector< pair<int, int> > &pri, vector<int> &div){
    if(dep >= pri.size()){
        div.push_back(num); 
        return;
    }
    for(int i = 0; i <= pri[dep].second; i++){
        GenDiv(dep + 1, num, pri, div);
        num *= pri[dep].first;
    }
}

int main(){
    int T;
    
    for(cin >> T; T; T--){
        int n;
        vector< pair<int, int> > pri;
        vector<int> div;
        
        cin >> n;
        GenFactors(n, pri);
        //cerr << "pri.size=" << pri.size()<<endl;
        GenDiv(0, 1, pri, div);
        sort(div.begin(), div.end());
        
        long long ans = 1;//for f(n,n)
        int f = n;//f(n, 1)
        
        for(int i = 1; i < div.size(); i++){
            //cerr << div[i] << " * ";
            ans += (long long)(div[i] - div[i - 1]) * f; 
            f = n / div[i];
        }
        //cerr<<endl;
        cout << ans << endl;
    }
    return 0;
}
